Skip to content

feat(context): 注入显示项目规制和状态#112

Merged
minorcell merged 3 commits into
1024XEngineer:mainfrom
wynxing:codex/issue-111-context-sources
Apr 1, 2026
Merged

feat(context): 注入显示项目规制和状态#112
minorcell merged 3 commits into
1024XEngineer:mainfrom
wynxing:codex/issue-111-context-sources

Conversation

@wynxing

@wynxing wynxing commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

背景

第二阶段需要让 internal/context 接入显式上下文源,在不破坏现有主链路边界的前提下,把项目规则文件和系统状态摘要注入到 system prompt 中。

本次修改

  • context.Builder 引入 Metadata,统一接收 workdirshellprovidermodel
  • 支持从当前 workdir 向上发现并加载大写 AGENTS.md,按“从全局到局部”注入 Project Rules
  • 注入 System State,包含 workdirshellprovidermodel、git branch、git dirty 摘要
  • 对规则文件内容和总注入长度做边界控制
  • 修复 review 中发现的边界问题:目录读取失败的降级处理、取消语义保留、规则段落总长度预算包含标题等附加内容
  • 补充 contextruntime 相关测试,并同步更新架构/事件流文档

验证

  • go test ./internal/context ./internal/runtime
  • go test ./...

Closes #111

@wynxing wynxing marked this pull request as draft April 1, 2026 14:52
@wynxing wynxing marked this pull request as ready for review April 1, 2026 15:01
@codecov

codecov Bot commented Apr 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.55556% with 42 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/context/source_rules.go 79.85% 16 Missing and 11 partials ⚠️
internal/context/source_system.go 79.62% 7 Missing and 4 partials ⚠️
internal/context/builder.go 71.42% 2 Missing and 2 partials ⚠️

📢 Thoughts on this report? Let us know!

@wynxing wynxing changed the title feat(context): inject explicit project rules and system state feat(context): 注入显示项目规制和状态 Apr 1, 2026
@minorcell minorcell merged commit 4b440e3 into 1024XEngineer:main Apr 1, 2026
3 checks passed
@wynxing wynxing deleted the codex/issue-111-context-sources branch April 15, 2026 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(context): 第二阶段接入显式上下文源(AGENTS.md 规则文件与系统状态)

2 participants